package xq.gwt.mvc.util;

import java.util.Date;

import com.google.gwt.i18n.client.DateTimeFormat;

public class DefaultDateFormatter implements DateFormatter {

	@Override
	public String format(Date val, String format){
		DateTimeFormat df = DateTimeFormat.getFormat(format);
	    return df.format(val);
		
	}

	@Override
	public Date parse(String val, String format) throws Exception{
		DateTimeFormat df = DateTimeFormat.getFormat(format);
        Date dateVal =  df.parse(val);
		return dateVal;
	}

}
